<template>
  <view class="content">
    <view>
      <view class="warehousing_list" v-if="vipcardlist.length > 0">
        <view
          class="warehousing_item"
          v-for="(item, index) in vipcardlist"
          :key="index"
        >
          <view class="warehousing_itemtop">
            <text>{{ item.titile }}</text>
            <view class="warehousing_edit">
              <u-icon
                name="edit-pen"
                color="#9e9d9d"
                @click="handleEdit(item.id)"
              ></u-icon>
              <!-- <u-icon
              name="trash"
              color="#fd8080"
              @click="goodsdel(goodsitem.id)"
            ></u-icon> -->
            </view>
          </view>
          <view class="warehousing_itemcontent">
            <view class="warehousing_content">
              <text>手机号:</text><text>{{ item.mobile }}</text>
            </view>
            <view class="warehousing_content">
              <text>售卖金额/月:</text><text>{{ item.money }}</text>
            </view>
            <view class="warehousing_content">
              <text>押金:</text><text>¥{{ item.deposit }}</text>
            </view>
            <view class="warehousing_content">
              <text>类型:</text>
              <text>{{ item.type_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>可租赁数量:</text><text>{{ item.num }}</text>
            </view>
            <view class="warehousing_content">
              <text>描述:</text>
              <!-- <text v-if=""></text> -->
              <text>{{ item.descript }}</text>
            </view>
            <view class="warehousing_content">
              <text>使用限制:</text><text>{{ item.astrict_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>状态:</text><text>{{ item.status_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>创建时间:</text><text>{{ item.createtime_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>修改时间:</text><text>{{ item.updatetime_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>出售折扣:</text><text>{{ item.sale_discount }}</text>
            </view>
            <view class="warehousing_content">
              <text>开始时间:</text><text>{{ item.starttime_text }}</text>
            </view>
            <view class="warehousing_content">
              <text>截止时间:</text><text>{{ item.endtime_text }}</text>
            </view>
          </view>
        </view>
      </view>
      <view v-else
        ><u-empty style="text-align: center" text="暂无会员卡数据"></u-empty
      ></view>
    </view>
    <view class="goodsadd" @click="handleAdd()"> 新增 </view>
    <u-toast ref="uToast" />
  </view>
</template>

<script>
export default {
  data() {
    return {
      vipcardlist: [],
    };
  },
  onLoad() {},
  mounted() {
    this.getVipCardList();
  },
  methods: {
    //   查询会员卡列表
    getVipCardList() {
      uni.request({
        url: "http://gxyckf.1qit.com/api/admin.user_card_hand/cardList", //仅为示例，并非真实接口地址。
        data: {},
        header: {
          token: uni.getStorageSync("token"),
        },
        success: (res) => {
          if (res.data.code == 1) {
            console.log(res.data.data);
            this.vipcardlist = res.data.data;
          }
        },
      });
    },

    // 会员卡修改
    handleEdit(id) {
      uni.navigateTo({
        url: "../vipcardEdit/vipcardEdit?id=" + id,
      });
    },
    // 会员卡新增
    handleAdd() {
      uni.navigateTo({
        url: "../vipcardAdd/vipcardAdd",
      });
    },
  },
};
</script>

<style>
page {
  background: #f6f6f6;
}
.usersearch {
  width: 90%;
  padding: 2% 5%;
  background: #fff;
}
.warehousing_list {
  width: 90%;
  margin: 0 5%;
}
.warehousing_item {
  background: #fff;
  margin: 20rpx 0;
  border-radius: 10rpx;
  box-shadow: 2rpx 2rpx 10rpx #eee;
  padding: 20rpx;
  padding-bottom: 0;
}
.warehousing_itemtop {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.warehousing_itemtop text {
  flex: 1;
  font-weight: 700;
}
.warehousing_edit {
  width: 150rpx;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.warehousing_itemcontent {
}
.warehousing_content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20rpx 0;
  font-size: 28rpx;
  color: #333;
}
.warehousing_content text:nth-child(1) {
}
.warehousing_content text:nth-child(2) {
  /* color: #9e9e9e; */
}
.goodsadd {
  position: fixed;
  bottom: 20rpx;
  right: 20rpx;
  width: 100rpx;
  height: 100rpx;
  border-radius: 100rpx;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28rpx;
}
</style>
